/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ui;

import biz.LoginProgess;
import entities.Role;
import java.util.LinkedList;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

/**
 *
 * @author TungGreen
 */
@ManagedBean
@SessionScoped
public class RoleProgess {

    @EJB
    private LoginProgess loginProgess;
    @EJB
    private biz.RoleProgess roleProgess;
    private List<Role> lstRole;

    /**
     *
     *Function get role of account
     * @return
     */
    public List<Role> getRoleAll() {
        //create list Role
        lstRole = new LinkedList<Role>();
        //call ejb
        lstRole = roleProgess.getAllRole();
        for (int i = 0; i < lstRole.size(); i++) {
            //get role
            Role u = lstRole.get(i);
            if (u.getName().equals("Admin")) {
                lstRole.remove(u);
            }
        }
        return lstRole;
    }
}
